<template>
    <div>
        <el-dialog title="查看疾病预警规则" :visible.sync="viewInfo.viewDialogVisible" width="35%" :close-on-click-modal="false">
            <div class="viewRule">
                <p>规则名称：{{ queryParams.ruleName }}</p>
                <p>预警参数：{{ queryParams.warningParam }}</p>
                <p>阈值：{{ queryParams.thresholdValue }}</p>
                <p>单位：{{ queryParams.warningUnit }}</p>
                <p>预警规则：
                    <span v-if="queryParams.rule === '0'">大于</span>
                    <span v-if="queryParams.rule === '1'">小于</span>
                    <span v-if="queryParams.rule === '2'">等于</span>
                    <span v-if="queryParams.rule === '3'">大于等于</span>
                    <span v-if="queryParams.rule === '4'">小于等于</span>
                </p>
                <p>预警等级：
                    <span v-if="queryParams.warningLevel === '0'">红</span>
                    <span v-if="queryParams.warningLevel === '1'">黄</span>
                    <span v-if="queryParams.warningLevel === '2'">蓝</span>
                </p>
                <p>预警适用范围：
                    <span v-if="queryParams.rangeApplication === '0'">个人</span>
                    <span v-if="queryParams.rangeApplication === '1'">班级</span>
                    <span v-if="queryParams.rangeApplication === '2'">学校</span>
                </p>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="close">确 定</el-button>
            </span>
        </el-dialog>
    </div>
</template>

<script>
import { getSettingView } from '@/api/base/diseaseWarningRules'

export default {
    props: {
        viewInfo: {
            type: Object,
            default: false
        }
    },
    data() {
        return {
            queryParams: {}
        };
    },
    mounted() {
        this.view()
    },
    methods: {
        close() {
            this.$emit('close')
        },
        //查看
        async view() {
            const { data, code, msg } = await getSettingView(this.viewInfo.id)
            if (code === 200) {
                this.queryParams = data
            }
        }
    },
};
</script>

<style scoped lang="scss">
.viewRule{
    padding: 0 30px;
}
</style>
